/**
 * FlightInfoDbTestSuite.java
 * Jan 15, 2010
 */
package com.dlplay.flightinfo.test;

import java.util.logging.Logger;

import junit.framework.Assert;

import org.junit.Test;

import com.dlplay.flightinfo.core.FlightSystem;
import com.dlplay.flightinfo.data.AirFlightCode;
import com.dlplay.flightinfo.data.AirlineCode;
import com.dlplay.flightinfo.data.RealTimeFlightInfo;

/**
 * @author zhang yu
 *
 */
public class FlightMngrTestSuite extends AbstractGaeTestSuite {
	
	@Test
	public void testExample() {
		log.info("FlightMngrTestSuite:");
		AirFlightCode ca1585 = new AirFlightCode(AirlineCode.CA, 1585);
		AirFlightCode ca1297 = new AirFlightCode(AirlineCode.CA, 1297);
		RealTimeFlightInfo fca1585;
		RealTimeFlightInfo fca1297;
		fca1585 = FlightSystem.getFlightManager().getRealTimeFlightInfo(ca1585);
		Assert.assertNotNull(fca1585);		
		fca1585 = FlightSystem.getFlightManager().getRealTimeFlightInfo(ca1585);
		Assert.assertNotNull(fca1585);	
		fca1297 = FlightSystem.getFlightManager().getRealTimeFlightInfo(ca1297);
		Assert.assertNotNull(fca1297);	
		boolean ret = FlightSystem.getFlightManager().registerEmail("tester", ca1585, "tester@ip.com");
		Assert.assertTrue(ret);		
		ret = FlightSystem.getFlightManager().registerEmail("tester1", ca1585, "tester@ip.com");
		Assert.assertFalse(ret);
		ret = FlightSystem.getFlightManager().registerEmail("tester", ca1297, "tester@ip.com");
		Assert.assertTrue(ret);	
		ret = FlightSystem.getFlightManager().registerEmail("tester", ca1297, "tester1@ip.com");
		Assert.assertTrue(ret);	
		FlightSystem.getPeriodManager().updateFlights();
	}

}
